package com.ysd.lis.controller.qi;

import com.ysd.common.Result;
import com.ysd.lis.annotation.LogDetail;
import com.ysd.lis.aspect.OperationType;
import com.ysd.lis.entity.qi.QiIndexMain;
import com.ysd.lis.request.CommonPageDto;
import com.ysd.lis.service.qi.QiIndexMainService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @program: server_lis
 * @author: liuQi
 * @create: 2024-01-29 17:02
 */
@Api(tags = "指标报表")
@RestController
@RequestMapping("/api/qi/report")
public class QiIndexMainController {

    @Autowired
    QiIndexMainService qiIndexMainService;

    @ApiOperation("获取指标报表列表")
    @GetMapping("/getQiIndexMainList")
    public Result getQiIndexMainList() {
        return qiIndexMainService.getQiIndexMainList();
    }

    @ApiOperation("添加质量指标")
    @PostMapping("/addQiIndexMain")
    @LogDetail(requestParam ="addQiIndexMain",operationType = OperationType.INSERT, module = "添加质量指标",content = "增加【indexName】质量指标", businessName = "indexName")
    public Result addQiIndexMain(@RequestBody QiIndexMain qiIndexMain) {
        return qiIndexMainService.addQiIndexMain(qiIndexMain);
    }

    @ApiOperation("编辑质量指标")
    @PostMapping("/updateQiIndexMain")
    @LogDetail(requestParam ="updateQiIndexMain",operationType = OperationType.UPDATE, module = "编辑质量指标",content = "增加【indexName】质量指标", businessName = "indexName")
    public Result updateQiIndexMain(@RequestBody QiIndexMain qiIndexMain) {
        return qiIndexMainService.updateQiIndexMain(qiIndexMain);
    }

    @ApiOperation("删除质量指标")
    @PostMapping("/deleteQiIndexMain")
    @LogDetail(requestParam ="deleteQiIndexMain",operationType = OperationType.DELETE, module = "删除质量指标",content = "增加【indexName】质量指标", businessName = "indexName")
    public Result deleteQiIndexMain(@RequestBody QiIndexMain qiIndexMain) {
        return qiIndexMainService.deleteQiIndexMain(qiIndexMain);
    }

    @ApiOperation("查询指标类型及指标父子结构")
    @GetMapping("/findQiIndexMainAndTypeList")
    public Result findQiIndexMainAndTypeList(CommonPageDto pageParam){
        return qiIndexMainService.findQiIndexMainAndTypeList(pageParam);
    }
}
